package com.gzy.net_app.ui.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import com.gzy.net_app.MainActivity;
import com.orhanobut.hawk.Hawk;

/**
 * @author : guzy
 * @program: net-app
 * @description: 启动页面
 * @date : 2022-03-26 12:06
 **/
public class SplashActivity extends Activity {

  public static final String TAG = "SplashActivity";

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    gotoMainActivity();
  }

  /**
   * 判断是否跳转到主页还是登陆界面
   */
  private void gotoMainActivity() {
    if (!TextUtils.isEmpty(Hawk.get("token"))) {
      Intent intent = new Intent(this, MainActivity.class);
      startActivity(intent);
    } else {
      Intent intent = new Intent(this, LoginActivity.class);
      startActivity(intent);
    }
    finish();
  }
}